<?php

require('../../../public/connection.php');
require('../../../class/Mysql.php');
$data = json_decode(file_get_contents('php://input'), true);
if (empty($data["name"]) || empty($data["heat"])) {
    die(json_encode(array("code" => 400, "msg" => "格式错误")));
}
$time = getDateTime();
$add_one_data = new Mysql();
$result = $add_one_data->addOrEditData(
    "insert into foodheats values(null,'{$data["name"]}','{$data["type"]}',{$data["heat"]},'{$data["remark"]}','{$time}');"
);
die(json_encode($result));
